window.phoenix&&(window.phoenix.buildInfo||(window.phoenix.buildInfo=[]),-1===window.phoenix.buildInfo.findIndex((e=>"Phoenix-platform"===e.MFE))&&window.phoenix.buildInfo.push({MFE:"Phoenix-platform",VERSION:"4f801c6",LASTCOMMITDATETIME:"2024-07-08T07:55:19+00:00"})) /*! * * ============= BUILD INFO ============= * MFE: Phoenix-platform * chunkName: service-clientlibs/graphql/graphql * VERSION: 4f801c6 * BRANCH: HEAD * COMMITHASH: 4f801c6a05dec11337fda6d090793eee14303a13 * LASTCOMMITDATETIME: 2024-07-08T07:55:19+00:00 * ============= If you're reading this, why not come work with us? https://www.t-mobile.com/careers ============= */,function(){"use strict";var e={334:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});const o=r(582);o.__exportStar(r(643),t),o.__exportStar(r(533),t),o.__exportStar(r(89),t),o.__exportStar(r(881),t),o.__exportStar(r(293),t)},643:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.PhoenixService=void 0;const o=r(533),n=r(89),i=r(881),a={appName:"phoenix-frontend-tooling",className:"PhoenixService"};t.PhoenixService=class{name;ufsAkmid="APM0228201";config;updateConfig;getConfig;isAuthorMode;putConfig;additionalRequestHeaders={};constructor(e,t){if(this.config=t||(0,n.findConfig)(e),!this.config)throw new Error(`${e.toString()} was not found. Unable to start the service.`);a.className=`${a.className}-${this.config.serviceName}`,this.isAuthorMode=this.setAuthorMode(),this.name=Symbol.for(`${this.config.serviceName} Service`)}setAuthorMode(){const e=document.querySelector("body");return"EDIT"===e?.dataset.wcmMode}async getData(e){if(!this.getConfig)throw new Error("No Get Method Defined");const t=e?.queryParameters?`?${e.queryParameters}`:"",r=`${this.getConfig?.basePath}/${this.getConfig?.servicePath}`+t,o=this.getConfig&&this.getConfig.headers?this.getConfig.headers:{},n=new Headers(o).get("transactionId")||window.uuid.v4(),i=performance.now();try{const t=await fetch(r,{method:"GET",body:JSON.stringify(e?.body),headers:o}),s=performance.now()-i,c=await t.json();if(t.ok){const i=await this.createClearwaterLog(n,JSON.stringify(e?.body),"GET",s,t.status,"Success",JSON.stringify(t),t.headers,`Success submitting the query to ${r} recieved ${t.status}`,r,this.convertHeadersToRecord(o));return window.phoenix.log.clearwater(i,a),c}{const i=`Error in GETDATA path of ${r} with response status of ${t.status}.`,c=await this.createClearwaterLog(n,JSON.stringify(e?.body),"GET",s,t.status,"Fault",JSON.stringify(t),t.headers,i,r,this.convertHeadersToRecord(o));throw window.phoenix.log.clearwater(c,a),new Error(i)}}catch(e){throw await this.handleErrorLogging(n,e,t,i,r,"GET",this.convertHeadersToRecord(o)),e}}async updateData(e){if(!this.updateConfig)throw new Error("No Update Method Defined");const t=e?.queryParameters?`?${e.queryParameters}`:"",r=`${this.updateConfig?.basePath}/${this.updateConfig?.servicePath}`+t,o={...this.updateConfig?.headers?this.updateConfig.headers:{},...this.additionalRequestHeaders},n=new Headers(o).get("transactionId")||window.uuid.v4(),i=performance.now();try{const t=await fetch(r,{method:"POST",body:JSON.stringify(e?.body),headers:o}),s=performance.now()-i,c=await t.json();if(t.ok){const i=await this.createClearwaterLog(n,JSON.stringify(e?.body),"POST",s,t.status,"Success",JSON.stringify(t),t.headers,`Success submitting the query to ${r} recieved ${t.status}`,r,this.convertHeadersToRecord(o));return window.phoenix.log.clearwater(i,a),c}{const i=`Error in UPDATEDATA path of ${r} recieved response status of ${t.status}.`,c=await this.createClearwaterLog(n,JSON.stringify(e?.body),"POST",s,t.status,"Fault",JSON.stringify(t),t.headers,i,r,this.convertHeadersToRecord(o));throw window.phoenix.log.clearwater(c,a),new Error(i)}}catch(t){throw await this.handleErrorLogging(n,t,JSON.stringify(e?.body),i,r,"POST",this.convertHeadersToRecord(o)),t}}async makeGqlQuery(e,t,r){const o=await(0,i.ufsHeaders)(),n=window.phoenix.configs?.apiDomainsConfigs?.graphql?.targetDomain,s=window.phoenix.configs?.apiDomainsConfigs?.graphql?.apiPath;n&&s||window.phoenix.log.warning("Warning: Missing GQL Domain or Path from configs",{...a,methodName:"makeGqlQuery"});const c=performance.now(),u=JSON.stringify({query:e,variables:t}),d={Accept:"application/json",...o,...r};try{const t=await fetch(`${n}${s}`,{method:"POST",headers:d,credentials:"omit",body:u}),r=performance.now()-c,i=await t.json();if(t.ok){const e=await this.createClearwaterLog(o["activity-id"],u,"POST",r,200,"Success",JSON.stringify(i),t.headers,"GQL success",`${n}${s}`,d);return window.phoenix.log.clearwater(e,{...a,methodName:"makeGQLQuery"}),i}{const c=`Error in GraphQL call of ${e} recieved response status of ${t.status}.`,l=await this.createClearwaterLog(o["activity-id"],u,"POST",r,200,"Error",JSON.stringify(i),t.headers,"GQL failure",`${n}${s}`,d);throw window.phoenix.log.clearwater(l,{...a,methodName:"makeGQLQuery"}),new Error(c)}}catch(e){throw await this.handleErrorLogging(o["activity-id"],e,u,c,`${n}${s}`,"POST",d),e}}async makePutRequest(e){if(!this.putConfig)throw new Error("No Update Method Defined");const t=e?.queryParameters?`?${e.queryParameters}`:"",r=`${this.putConfig?.basePath}/${this.putConfig?.servicePath}`+t,o=this.putConfig&&this.putConfig.headers?this.putConfig.headers:{},n=new Headers(o).get("transactionId")||window.uuid.v4(),i=performance.now();try{const t=await fetch(r,{method:"PUT",body:JSON.stringify(e?.body),headers:o}),s=performance.now()-i,c=await t.json();if(t.ok){const i=await this.createClearwaterLog(n,JSON.stringify(e?.body),"PUT",s,t.status,"Success",JSON.stringify(t),t.headers,`Success submitting the query to ${r} recieved ${t.status}`,r,this.convertHeadersToRecord(o));return window.phoenix.log.clearwater(i,a),c}{const i=`Error in UPDATEDATA path of ${r} recieved response status of ${t.status}.`,c=await this.createClearwaterLog(n,JSON.stringify(e?.body),"PUT",s,t.status,"Fault",JSON.stringify(t),t.headers,i,r,this.convertHeadersToRecord(o));throw window.phoenix.log.clearwater(c,a),new Error(i)}}catch(t){const s=await this.createClearwaterLog(n,JSON.stringify(e?.body),"POST",performance.now()-i,599,"Fault","unknown",null,`Error submitting the query to ${r}`,r,this.convertHeadersToRecord(o));throw window.phoenix.log.clearwater(s,a),t}}async createClearwaterLog(e,t,r,n,i,s,c,u,d,l,f,p){const h={};u&&u.forEach(((e,t)=>{h[t]=e}));const w=window.Cookies.get("id_token")||window.Cookies.get("a_token");let y="";if(w)try{const e=await(0,o.decodeJWT)(w);y=e?.usn||""}catch(e){window.phoenix.log.warning("Error decoding token:",a,e)}return{RequestId:e,RequestTime:(new Date).toString(),Sender:y,SenderType:"USER",Method:r,Receiver:this.ufsAkmid,Duration:n,ResponseStatusCode:i,Result:s,RequestHeaders:f||{},RequestBody:t,ResponseHeaders:h,ResponseBody:c,TargetEndpoint:window.location.origin+l,msg:d,obj:p}}convertHeadersToRecord(e){const t={},r=e;for(const e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e]);return t}async handleErrorLogging(e,t,r,o,n,i,s){if(t instanceof Error&&!t?.message.match(/with response status/gi)){const t=await this.createClearwaterLog(e,r,i,performance.now()-o,599,"Fault","unknown",null,`Error submitting the query to ${n}`,n,s);window.phoenix.log.clearwater(t,a)}throw t}async start(){this.isAuthorMode?window.phoenix.log.warning("Author Mode detected, stopping api calls!",a):this.setupMethods()}stop(){}setupMethods(){this.config?.methods.forEach((e=>{switch(e.method){case"GET":this.getConfig=e;break;case"POST":this.updateConfig=e;break;case"PUT":this.putConfig=e}}))}}},293:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},533:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.decodeJWT=void 0;t.decodeJWT=async e=>{try{const t=e.split(".")[1],r=t?.replace(/-/g,"+").replace(/_/g,"/"),o=decodeURIComponent(window.atob(r).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""));return Promise.resolve(JSON.parse(o))}catch(t){throw new Error(`Unable to parse token! ${t}; Using provided token: ${e}`)}}},89:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.findConfig=void 0,t.findConfig=function(e){if(window?.phoenix?.configs?.serviceConfigs){const t=window.phoenix.configs.serviceConfigs.filter((t=>t.serviceName.toLowerCase()===e.toString().toLowerCase()));return 1===t.length?t[0]:void 0}}},881:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.ufsHeaders=void 0;const o=r(533);let n={"Content-Type":"application/json","session-id":"","interaction-id":"","workflow-id":"","sub-workflow-id":"","activity-id":"","channel-id":"WEB","application-id":"APM0226219-PHX","service-transaction-id":"",timestamp:"","origin-application-id":"APM0226219-PHX"};t.ufsHeaders=async e=>{if(e){const t=window.phoenix.configs?.usGraphConfigs?.find((t=>t?.intent?.toUpperCase()===e.toUpperCase()))?.headers;t&&(n=t)}const t=await window.phoenix.persistedState.get("PDP_TRANSACTION_TYPE");n["workflow-id"]=t||"UPGRADE","UPGRADE"===n["workflow-id"]?n["interaction-id"]="097ebb03-fdde-454b-89bb-257d74677019":n["interaction-id"]=window.uuid.v4();const r=document?.head?.dataset.analyticsPagePagename;n["sub-workflow-id"]=r||"unknown",n["service-transaction-id"]=window.uuid.v4(),n["activity-id"]=window.uuid.v4();const i=window.Cookies.get("id_token")?window.Cookies.get("id_token"):window.Cookies.get("a_token");if(i){const e=await(0,o.decodeJWT)(i);e&&e?.usn&&(n["session-id"]=e.usn),n["session-id"]||(n["session-id"]=window.uuid.v4())}else n["session-id"]=window.uuid.v4();return n.timestamp=(new Date).toISOString(),n}},252:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});const o=r(582);o.__exportStar(r(144),t),o.__exportStar(r(421),t),o.__exportStar(r(864),t),o.__exportStar(r(157),t),o.__exportStar(r(816),t),o.__exportStar(r(429),t),o.__exportStar(r(935),t),o.__exportStar(r(658),t),o.__exportStar(r(46),t),o.__exportStar(r(122),t),o.__exportStar(r(475),t),o.__exportStar(r(327),t),o.__exportStar(r(556),t),o.__exportStar(r(892),t)},144:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},421:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},864:function(e,t){Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e){const t={appName:"phoenix",className:Symbol.keyFor(e)??"Error no ClassName"};window.phoenix.log.info(`${e.toString()} Starting`,t)}handleErrors(){}}},157:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.PhoenixService=void 0;var o=r(334);Object.defineProperty(t,"PhoenixService",{enumerable:!0,get:function(){return o.PhoenixService}})},816:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r,...o){if(!e)throw"startFunc is not defined";t||(t="unassigned"),r||(r="unassigned");const n={appName:r,className:t};let i=null;try{return i=o?new e(...o):new e,window.phoenix.log.debug(`Started ${t}.`,n),i}catch(e){return window.phoenix.log.error(`Error Starting service ${e}`,n,{exception:e}),i}}},429:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.productTypeFromCategory=t.productFamilyCategoryMapper=void 0;t.productFamilyCategoryMapper=e=>{const t=e.pathname;if(t.match(/\/cellphone\/|\/cellphones\/|\/cell-phones\/|\/cell-phone\/|\/cell-phones$/gi))return"CELLPHONES";if(t.match(/\/tablet\/|\/tablets\/|\/tablets$/gi))return"TABLETS";if(t.match(/\/smart-watch\/|\/smartwatches\/|\/smart-watches$/gi))return"SMARTWATCHES";if(t.match(/\/hotspot-iot-connected-device\/|\/hotspots-iot-connected-devices\/|\/hotspot-iot-connected-devices\/|\/hotspots-iot-connected-devices$|\/hotspots_iot_connected_devices$/gi))return"HOTSPOTS_IOT_CONNECTED_DEVICES";return t.match(/\/accessory\/|\/accessoriess\/|\/accessories$/gi)?"ACCESSORIES":null};t.productTypeFromCategory=e=>{if("CELLPHONES"===e)return"Cell Phone";if("TABLETS"===e)return"Tablet";if("SMARTWATCHES"===e)return"Smart Watch";if("HOTSPOTS_IOT_CONNECTED_DEVICES"===e)return"HotSpot & IoT";return"ACCESSORIES"===e?"Accessory":null}},935:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.correlationIdCheck=void 0,t.correlationIdCheck=async function(e){let t=await window.localforage.getItem("HSIcorrelationId");t||(t=window.uuid.v4(),await window.localforage.setItem("HSIcorrelationId",t)),e.correlationId=t}},658:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.decodeJWT=void 0;var o=r(334);Object.defineProperty(t,"decodeJWT",{enumerable:!0,get:function(){return o.decodeJWT}})},46:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.arrayBufferFromBase64=t.downloadPDFromBase64=void 0;t.downloadPDFromBase64=(e,r)=>{const o=(0,t.arrayBufferFromBase64)(e),n=new Blob([o],{type:"application/pdf"}),i=window.URL.createObjectURL(n),a=document.createElement("a");a.href=i,a.download=`${r}.pdf`,a.click(),window.URL.revokeObjectURL(i),a.remove()};t.arrayBufferFromBase64=e=>{const t=window.atob(e),r=t.length,o=new Uint8Array(r);for(let e=0;e{window.phoenix.bus.publish("GRAPHQL","GRAPHQL_REQUEST",{payload:{query:e.replace(/(\r\n|\n|\r)/gm,"").trim(),identifier:t,variables:r,headers:o,channel:n,topic:i}})};t.getGraphQLError=e=>{const t=e?.error,r=t?.[0]?.message;return{code:t?.[0]?.extensions?.code||t?.code,message:r}}},475:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.applyScrollMarginTop=void 0,t.applyScrollMarginTop=function(e={}){const{marginTop:t,timeout:r}=e,o=()=>{const e=(parseInt(document.documentElement.style.getPropertyValue("--js--header-height-overall"),10)||0)+parseInt(t||"0",10);if(e>0){const t=document.createElement("style");t.innerHTML=`:target { scroll-margin-top: ${e}px; }`,document.head.appendChild(t)}};"number"==typeof r?setTimeout(o,r):o()}},327:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.safeJsonParse=void 0,t.safeJsonParse=function(e){try{return JSON.parse(e)}catch(t){return window.phoenix.log.warning(`Error parsing JSON string ${e}`,{appName:"phoenix-frontend-tooling",className:"ES Module - JSON utils",methodName:"safeJsonParse"}),{}}}},556:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatPhoneNumber=void 0,t.formatPhoneNumber=function(e){if(null==e)return;const t=e.replace(/\D/g,"");if(10!==t.length)return;const r=t.match(/^(\d{3})(\d{3})(\d{4})$/);return`(${r[1]}) ${r[2]}-${r[3]}`}},892:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.ufsHeaders=void 0;var o=r(334);Object.defineProperty(t,"ufsHeaders",{enumerable:!0,get:function(){return o.ufsHeaders}})},582:function(e,t,r){r.r(t),r.d(t,{__addDisposableResource:function(){return A},__assign:function(){return i},__asyncDelegator:function(){return E},__asyncGenerator:function(){return O},__asyncValues:function(){return T},__await:function(){return P},__awaiter:function(){return h},__classPrivateFieldGet:function(){return R},__classPrivateFieldIn:function(){return N},__classPrivateFieldSet:function(){return D},__createBinding:function(){return y},__decorate:function(){return s},__disposeResources:function(){return L},__esDecorate:function(){return u},__exportStar:function(){return g},__extends:function(){return n},__generator:function(){return w},__importDefault:function(){return $},__importStar:function(){return j},__makeTemplateObject:function(){return x},__metadata:function(){return p},__param:function(){return c},__propKey:function(){return l},__read:function(){return _},__rest:function(){return a},__runInitializers:function(){return d},__setFunctionName:function(){return f},__spread:function(){return v},__spreadArray:function(){return S},__spreadArrays:function(){return b},__values:function(){return m}});var o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},o(e,t)};function n(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var i=function(){return i=Object.assign||function(e){for(var t,r=1,o=arguments.length;r=0;s--)(n=e[s])&&(a=(i<3?n(a):i>3?n(t,r,a):n(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function c(e,t){return function(r,o){t(r,o,e)}}function u(e,t,r,o,n,i){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,c=o.kind,u="getter"===c?"get":"setter"===c?"set":"value",d=!t&&e?o.static?e:e.prototype:null,l=t||(d?Object.getOwnPropertyDescriptor(d,o.name):{}),f=!1,p=r.length-1;p>=0;p--){var h={};for(var w in o)h[w]="access"===w?{}:o[w];for(var w in o.access)h.access[w]=o.access[w];h.addInitializer=function(e){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(e||null))};var y=(0,r[p])("accessor"===c?{get:l.get,set:l.set}:l[u],h);if("accessor"===c){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(s=a(y.get))&&(l.get=s),(s=a(y.set))&&(l.set=s),(s=a(y.init))&&n.unshift(s)}else(s=a(y))&&("field"===c?n.unshift(s):l[u]=s)}d&&Object.defineProperty(d,o.name,l),f=!0}function d(e,t,r){for(var o=arguments.length>2,n=0;n0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function _(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var o,n,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return a}function v(){for(var e=[],t=0;t1||s(e,t)}))})}function s(e,t){try{(r=n[e](t)).value instanceof P?Promise.resolve(r.value.v).then(c,u):d(i[0][2],r)}catch(e){d(i[0][3],e)}var r}function c(e){s("next",e)}function u(e){s("throw",e)}function d(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function E(e){var t,r;return t={},o("next"),o("throw",(function(e){throw e})),o("return"),t[Symbol.iterator]=function(){return this},t;function o(o,n){t[o]=e[o]?function(t){return(r=!r)?{value:P(e[o](t)),done:!1}:n?n(t):t}:n}}function T(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=m(e),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(r){t[r]=e[r]&&function(t){return new Promise((function(o,n){(function(e,t,r,o){Promise.resolve(o).then((function(t){e({value:t,done:r})}),t)})(o,n,(t=e[r](t)).done,t.value)}))}}}function x(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var C=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function j(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&y(t,e,r);return C(t,e),t}function $(e){return e&&e.__esModule?e:{default:e}}function R(e,t,r,o){if("a"===r&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?o:"a"===r?o.call(e):o?o.value:t.get(e)}function D(e,t,r,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?n.call(e,r):n?n.value=r:t.set(e,r),r}function N(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function A(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");o=t[Symbol.asyncDispose]}if(void 0===o){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");o=t[Symbol.dispose]}if("function"!=typeof o)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:o,async:r})}else r&&e.stack.push({async:!0});return t}var k="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var o=new Error(r);return o.name="SuppressedError",o.error=e,o.suppressed=t,o};function L(e){function t(t){e.error=e.hasError?new k(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function r(){for(;e.stack.length;){var o=e.stack.pop();try{var n=o.dispose&&o.dispose.call(o.value);if(o.async)return Promise.resolve(n).then(r,(function(e){return t(e),r()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}t.default={__extends:n,__assign:i,__rest:a,__decorate:s,__param:c,__metadata:p,__awaiter:h,__generator:w,__createBinding:y,__exportStar:g,__values:m,__read:_,__spread:v,__spreadArrays:b,__spreadArray:S,__await:P,__asyncGenerator:O,__asyncDelegator:E,__asyncValues:T,__makeTemplateObject:x,__importStar:j,__importDefault:$,__classPrivateFieldGet:R,__classPrivateFieldSet:D,__classPrivateFieldIn:N,__addDisposableResource:A,__disposeResources:L}}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,r),i.exports}r.d=function(e,t){for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},function(){var e=r(252);class t{name;logDetails;ufsAkmid="APM0228201";defaultChannel="GRAPHQL";defaultTopic="GRAPHQL_REQUEST";endpointDomain=window.phoenix.configs?.apiDomainsConfigs?.graphql?.targetDomain;endpointPath=window.phoenix.configs?.apiDomainsConfigs?.graphql?.apiPath;constructor(){this.name=Symbol("Phoenix GraphQL Service"),this.logDetails={appName:"phoenix-platform",className:"Phoenix GraphQL Service"},this.startApp()}async graphqlRequest(t){const r=t?.payload?.channel??this.defaultChannel,o=t?.payload?.topic??this.defaultTopic,n=t?.payload?.identifier,i=t?.payload?.query,a=t?.payload?.variables,s=t?.payload?.headers,c={Accept:"application/json",...await(0,e.ufsHeaders)(),...s},u=JSON.stringify({query:i,variables:a});"true"===localStorage.getItem("gql.mocks")&&(this.endpointDomain=window.phoenix.configs?.apiDomainsConfigs?.graphqlmock?.targetDomain,this.endpointPath=window.phoenix.configs?.apiDomainsConfigs?.graphqlmock?.apiPath);const d=performance.now();try{const e=await fetch(`${this.endpointDomain}${this.endpointPath}`,{method:"POST",headers:c,credentials:"omit",body:u}),t=performance.now()-d,i=await e.json(),{data:a,errors:s}=i||{};if(200!=e.status){const a=this.createClearwaterLog(c,u,t,e.status,"Fault",JSON.stringify(i),e.headers,`Error submitting the query to ${this.endpointDomain}${this.endpointPath} recieved ${e.status}`);return window.phoenix.log.clearwater(a,this.logDetails),void window.phoenix.bus.publish(r,`${o}_FAILURE`,{payload:{response:void 0,error:i,identifier:n}})}if(s){const d=this.createClearwaterLog(c,u,t,200,"Fault",JSON.stringify(i),e.headers,`Error submitting the query to ${this.endpointDomain}${this.endpointPath}`,s);return window.phoenix.log.clearwater(d,this.logDetails),void window.phoenix.bus.publish(r,`${o}_SUCCESS_WITH_ERRORS`,{payload:{response:a,error:s,identifier:n}})}if(!a||!Object.values(a)?.[0]){const a=this.createClearwaterLog(c,u,t,e.status,"Fault",JSON.stringify(i),e.headers,`Error submitting the query to ${this.endpointDomain}${this.endpointPath} recieved ${e.status}`);return window.phoenix.log.clearwater(a,this.logDetails),void window.phoenix.bus.publish(r,`${o}_FAILURE`,{payload:{response:void 0,identifier:n}})}const l=function(e){let t=!1;return Object.keys(e).some((r=>{const o=e[r];o&&o.hasOwnProperty("code")&&o.hasOwnProperty("message")||o&&o.hasOwnProperty("code")&&o.hasOwnProperty("systemMessage")?t=!0:o instanceof Object&&Object.keys(o).length>0&&(t=l(o))})),t};if(l(a)){const s=this.createClearwaterLog(c,u,t,200,"Error",JSON.stringify(i),e.headers,`Error submitting the query to ${this.endpointDomain}${this.endpointPath}`);return window.phoenix.log.clearwater(s,this.logDetails),void window.phoenix.bus.publish(r,`${o}_SUCCESS_WITH_ERROR_CODE`,{payload:{response:a,error:void 0,identifier:n}})}const f=this.createClearwaterLog(c,u,t,200,"Success",JSON.stringify(i),e.headers,`Success query for ${this.endpointDomain}${this.endpointPath}`);window.phoenix.log.clearwater(f,this.logDetails),window.phoenix.bus.publish(r,`${o}_SUCCESS`,{payload:{response:a,error:void 0,identifier:n}})}catch(e){const t=this.createClearwaterLog(c,u,performance.now()-d,200,"Fault","unknown",null,`Error submitting the query to ${this.endpointDomain}${this.endpointPath}`,e);window.phoenix.log.clearwater(t,this.logDetails),window.phoenix.bus.publish(r,`${o}_FAILURE`,{payload:{response:void 0,error:e,identifier:n}})}}createClearwaterLog(e,t,r,o,n,i,a,s,c){const u={};if(a)for(const e of a.entries())u[e[0]]=e[1];return{RequestId:e?.["activity-id"],RequestTime:e.timestamp,Sender:e?.["session-id"],SenderType:"USER",Method:"POST",Receiver:this.ufsAkmid,Duration:r,ResponseStatusCode:o,Result:n,RequestHeaders:e,RequestBody:t,ResponseHeaders:u,ResponseBody:i,TargetEndpoint:`${this.endpointDomain}${this.endpointPath}`,msg:s,obj:c}}startApp(){window.phoenix.bus.subscribe("GRAPHQL","GRAPHQL_REQUEST",this.graphqlRequest.bind(this))}stop(){}}const o={appName:"phoenix-platform",className:"GraphQL Service"};try{new t}catch(e){window.phoenix.log.error("Error starting GraphQL service",o,{exception:e})}}()}();